package com.yvon.service.demo.spring.context.support;

import com.yvon.service.demo.spring.beans.BeansException;


/**
 * xml应用程序上下文
 * 具体是对外给用户提供的应用上下文类
 *
 * @author : Yvon
 * @since : 2022-12-07
 */
public class ClassPathXmlApplicationContext extends AbstractXmlApplicationContext {

    private String[] configLocations;

    public ClassPathXmlApplicationContext() {

    }

    /**
     * 从 xml文件中加载BeanDefinition，并刷新上下文
     *
     * @param configLocations 配置位置
     * @return {@code  }
     */
    public ClassPathXmlApplicationContext(String configLocations) throws BeansException {
        this(new String[]{configLocations});
    }

    /**
     * 从 xml文件中加载BeanDefinition，并刷新上下文
     *
     * @param configLocations 配置位置
     * @return {@code  }
     */
    public ClassPathXmlApplicationContext(String[] configLocations) throws BeansException {
        this.configLocations = configLocations;
        refresh();
    }


    @Override
    protected String[] getConfigLocations() {
        return configLocations;
    }
}
